package com.zx.cloud.domain.enums;

import com.zx.cloud.common.mybatis.handler.CodeEnum;

/**
 * 任务状态枚举
 */
public enum TaskStatusEnum implements CodeEnum<TaskStatusEnum> {

	NONE(0, "待执行"), NORMAL(1, "正常"), PAUSED(2, "暂停"), COMPLETE(3, "完成"), ERROR(4, "错误"), BLOCKED(5, "执行中"),DELETED(6, "删除"),RESUME(7, "恢复"),INSERT(8, "添加");

	private int code;
	private String desc;

	private TaskStatusEnum(int code, String desc) {
		this.code = code;
	}

	/**
     * 通过枚举<code>name</code>获取枚举
     */
    public static TaskStatusEnum getEnumByCode(Integer code) {
    	if(code==null){
    		return null;
    	}
        for (TaskStatusEnum enumm : TaskStatusEnum.values()) {
            if (enumm.getCode()==code.intValue()) {
                return enumm;
            }
        }
        return null;
    }
    
	@Override
	public int getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}

}

